package com.juc.scheduledExecutorService.scheduledExecutorService5;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Run {
	     //scheduleAtFixedRate周期性的运行
		// 执行任务的时间小于 period 预定的周期时间
		public static void main(String[] args) {
			ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
		    System.out.println("  X= " + System.currentTimeMillis());
		    executorService.scheduleAtFixedRate(new MyRunnable(), 1, 2, TimeUnit.SECONDS);
		    System.out.println("  Y= " + System.currentTimeMillis());

		}
}
